<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2019/10/24
  Time: 14:50
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-1.8.2.js"></script>
</head>
<body>
<center>
    <form id="loginform" action="getWebLogin.do" method="post">
        用户名:<input type="text" name="cname"/><br>
        密码:<input type="password" name="pwd"/><br>
        <input type="button" value="提交" onclick="checklogin()"/>
    </form>
</center>
</body>
<script>
    function checklogin() {
        //var dataform = $("#loginform").serialize();
        var cname=$("[name='cname']").val();
        var pwd=$("[name='pwd']").val();
        $.post(
            "getWebLogin.do?m="+Math.random(),
            {cname:cname,pwd:pwd},
            function (data) {
                if(data=='ok'){
                    window.close();
                }else{
                    alert("登录失败");
                }
            }
        );
    }
</script>
</html>
